#ifndef					_DATAMGR_H_
#define					_DATAMGR_H_

#include "stdafx.h"
#include <string>
#include <vector>
#pragma once
#include <afx.h>
#include <atlstr.h>
#include "NetflixDataElement.h"

class CNode;
class CTFIDF;

class CDataMgr
{
public:
	enum
	{
		NUMOFDATA = 50,
	};

	virtual ~CDataMgr();

	bool				Create();
	bool				Destroy();
	bool				FlagCreate()	{	return m_bFlagCreate; }

	std::vector<std::pair<int, float> > Query(std::string query);

	bool				GetData(unsigned int nID, NetflixDataElement& data);
	static CDataMgr*	Instance();

private:
	CDataMgr(); 
	CDataMgr(const CDataMgr&);
	CDataMgr& operator=(const CDataMgr&);

	void				m_LoadData();
	void				m_LoadEmotion();
	void				m_InitTFIDF();

	bool				m_bFlagCreate;
	std::vector<NetflixDataElement>	m_dataSet;
	static CDataMgr*	m_ptrDataMgr;
	CTFIDF*				m_ptrTFIDF;

protected:
	std::string			t_ConvertCStringToString(CString cStr);
	NetflixDataElement	t_ReadFile(TCHAR* fName, int movieId);
	void				t_Parse(CNode* pNode, std::vector<CNode*> &parsedStrs);
	void				t_Fill(CNode* pNode);
};
	
#endif					//_DATAMGR_H_

